#ifndef EXPENSE_H
#define EXPENSE_H

#include "expense_struct_csv.hpp"

#include "boost/date_time/posix_time/posix_time.hpp"
#include <iostream>
#include <fstream>

using namespace boost::posix_time;
using namespace boost::gregorian;

class expense
{
  public:
	inline expense() { }

	inline virtual ~expense() {};

  private:
};

// implementation for csv files

class expense_csv: public expense
{
protected:	

	

  public:

	inline expense_csv(char* filename): file(filename) { }

	expense_csv();

	~expense_csv();	

	static std::pair<float, float> const report_expenses(int _empl_id, date _first_date, date _last_date, bool _include_last_date = true, std::ofstream* _fp=NULL);

	static std::pair<float, float> const report_expense_type(int _empl_id, int _allowance_type, date _first_date, date _last_date, bool _include_last_date = true, std::ofstream* _fp=NULL);

	static std::pair<float, float> const get_expense_type(int _empl_id, int _allowance_type_id, std::vector<int>& activity_list, 
												   std::multimap<int, date>& activity_date_relation, 
												   std::multimap<int, std::pair<float, float> >& activity_refund_relation,
												   std::multimap< std::pair<int, date>, expense_struct_csv>& activity_expense_relation,
												   date _first_date, date _last_date, bool _include_last_date = true);

  protected:
	static bool check_parm(expense_struct_csv& row,
		int _empl_id, date _first_date, date _last_date, bool _include_last_date = true);

	//static float report_daily_expenses(float* _daily_expenses, date _date_ref, int _activity_id=0, std::ofstream* _fp = NULL);
	//static void sum_daily_expenses(float _daily_expenses[], float _cumulative_expenses[]);

  private:

	static void init_daily_expenses(float _daily_expenses[]);

	std::string file;

};
#endif
